package 递归;

public class Demo1 {
    public static void main(String[]args){
        System.out.println(fac(4));
        System.out.println(f(5));
    }

    /**
     * 计算n的阶乘
     * @param n
     * @return
     */

    public static int fac(int n){
        if (n<2)return 1;
        return n*fac(n-1);
    }


    public static int f(int n){
        if (n<2)return 2;
        return f(n-1)+f(n-2);
    }
}
